home *** CD-ROM | disk | FTP | other *** search
/ Fritz: All Fritz / All Fritz.zip / All Fritz / FILES / UTILREEN / PRNTUTIL.LZH / SETE.ASM < prev    next >
Assembly Source File  |  1985-08-29  |  7KB  |  153 lines

  1. ;      SETE.ASM
  2. ;      This is code for the IBM PC et al that provides a menu driven
  3. ;      set-up routine for the Epson FX80 printer. Alternately, a
  4. ;      command tail can be used, using the same codes as given in the menu.
  5. ;      This program is placed in the public domain and is written by
  6. ;      Joseph C. Hudson, 4198 Warbler Dr. Flint, MI 48504
  7. ;      Adapted from GEMSET.ASM by
  8. ;      R.R.Jones 226 Valley Rd. Lawrenceville, Ga. 30245 MNet 70270,117
  9.  
  10.       cr     equ 0Dh
  11.       lf     equ 0Ah
  12.       conout equ 9
  13.       getcon equ 7
  14.  
  15.       setp     segment byte
  16.  
  17.       assume cs:setp
  18.       org     100h               ;Setup as COM file
  19. begin:      jmp     start               ;Skip over data area
  20.       comnd  db  ?               ;variable to hold command
  21.       istail db  ?               ;dummy variable for tail
  22.       numrem db  ?               ;var for no of chars still in tail
  23.           banner db  cr,lf,lf,lf,lf,lf,'       '
  24.                  db ' (A) Pica (10)                     (J) Cancel Italics'
  25.                  db cr,lf,lf,'       '
  26.               db ' (B) Elite (12)                    (K) Skip Over Perf 2 Lines'
  27.                  db cr,lf,lf,'       '
  28.                db ' (C) Condensed (17)                (L) Set Left Margin at 10'
  29.                  db cr,lf,lf,'       '
  30.                  db ' (D) Unidirectional Printing       (M) Expanded Print'
  31.                  db cr,lf,lf,'       '
  32.                  db ' (E) Emphasized                    (N) Cancel Expanded'
  33.                  db cr,lf,lf,'       '
  34.                  db ' (F) Cancel Emphasized             '
  35.                  db cr,lf,lf,'       '
  36.                  db ' (G) Double Strike                 (P) Print Test Line'
  37.                  db cr,lf,lf,'       '
  38.                  db ' (H) Cancel Double Strike          (Q) Quit'
  39.                  db cr,lf,lf,'       '
  40.                  db ' (I) Italics                       (R) Reset Printer'
  41.                  db cr,lf,lf,'       '
  42.                  db '$'
  43.  
  44. ;*****************************************************************************
  45. ; Here begin the definitions of the printer control strings. This is a         *
  46. ; table where each entry begins with the unique search key formed in al      *
  47. ; by the routine "highbit", is followed in memory by the actual printer      *
  48. ; control codes, and ends with a zero. When the key is found the lineprinter *
  49. ; will be sent everthing after the key, up to the -1 which is the "stopper"  *
  50. ;*****************************************************************************
  51.  
  52.           ptable db 225,27,'P',18,-1   ;A - Each code group must end in -1
  53.                  db 226,27,'M',-1      ;B
  54.          db 227,15,-1           ;C
  55.                  db 228,27,'U',1,-1    ;D
  56.                  db 229,27,'E',-1      ;E
  57.                  db 230,27,'F',-1      ;F
  58.                  db 231,27,'G',-1      ;G
  59.                  db 232,27,'H',-1      ;H
  60.                  db 233,27,'4',-1      ;I
  61.                  db 234,27,'5',-1      ;J
  62.                  db 235,27,'N',2,-1    ;K
  63.                  db 236,27,'l',10,-1   ;L
  64.                  db 237,27,'W',1,-1    ;M
  65.                  db 238,27,'W',0,-1    ;N
  66.                  db 240,'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLNO',-1 ;P
  67.                  db 242,,27,'@',-1     ;R
  68.       endtable equ $
  69.       lentbl equ endtable - ptable ;Get length of printer string table
  70.  
  71. start:      mov     istail,0           ;set tail dummy to 0
  72.       mov     si,offset 80h           ;go to command tail
  73.       mov     al,[si]           ;get length of command tail
  74.       mov     numrem,al           ;put length of tail in numrem
  75. again:      cmp     numrem,0           ;is there any tail left?
  76.       jne     proceed           ;yes, proceed
  77.       cmp     istail,0           ;no, was there a tail?
  78.       je     start1            ;no, go get commands
  79.       jmp     quit               ;yes, all done, so quit.
  80. proceed:  inc     si               ;point at next character in tail
  81.       dec     numrem            ;decrement counter
  82.       mov     al,[si]           ;get next character from tail
  83.       or     al,20h            ;make it lower case
  84.       cmp     al,6fh            ;is it o?     }remove these 2 lines
  85.       je     again               ;yes, not command }if you add o as a
  86.       cmp     al,60h            ;is it below a?            command.
  87.       jle     again               ;yes, so not a letter
  88.       cmp     al,73h            ;no. is it above r?
  89.       jge     again               ;yes, so not a command
  90.       mov     istail,1           ;no, is a command. Set dummy to 1
  91.       jmp     chkq               ;process the command
  92.  
  93. start1:   mov     dx,offset banner      ;point to banner
  94.       mov     ah,conout           ;write to console function
  95.       int     21h               ;call DOS
  96.  
  97. keyget:   mov     ah,getcon           ;get character from keyboard
  98.       int     21h
  99.       or     al,20h            ;change to lower case
  100.       mov     dl,al
  101.       mov     ah,02h            ;write character to screen
  102.       int     21h
  103.  
  104. ; There is 1 special case - Q returns to DOS
  105.  
  106. chkq:     mov    bl,'q'                ;special handling for q
  107.       cmp     al,bl               ;Does he want to quit now?
  108.       jne     highbit           ;No, not a q, check other possibilities
  109.  
  110. quit:      call     crlf               ;Send cr and lf to printer
  111.       mov     ah,4ch            ; and quit.
  112.       int     21h
  113.  
  114. highbit:  mov     comnd,al           ;save command
  115.       or     al,10000000b           ;setup search key
  116.       mov     di,offset ptable      ;setup to see table
  117.       mov     cx,lentbl           ;get length of table into counter
  118. next:      mov     ah,[di]           ;take table entry
  119.       cmp     al,ah               ;is this equal to search key?
  120.       je     gotpntr           ;yes, now send string to printer
  121.       dec     cx               ;no, continue search , dec counter
  122.       jcxz     keyget            ;if counter is 0 not a legal search key
  123.       inc     di               ;one deeper into table, please
  124.       jmp     next               ;and look at another table byte
  125. gotpntr:  inc     di               ;Bump past key
  126.       mov     dl,[di]           ;take byte in to be sent to printer
  127.       mov     dh,-1               ;set up to see if end of print string
  128.       cmp     dl,dh               ;set zero flag if so
  129.       je     lpfin               ;yes, all done, finish up printer
  130.       mov     ah,5               ;pr inter code
  131.       int     21h
  132.       jmp     gotpntr           ;get next printer string byte
  133. lpfin:      mov     al,comnd           ;get command back
  134.           cmp    al,'p'                ;did we print test line?
  135.       jne     nextone           ;no, continue
  136.       call     crlf               ;yes, send cr and lf to printer
  137. nextone:  cmp     istail,0           ;do we have a tail?
  138.       je     keyget            ;no, go wait for command
  139.       jmp     again               ;yes, continue processing tail
  140.  
  141. crlf      proc     near               ;send cr and lf to printer
  142.       mov     ah,5               ;printer function number
  143.       mov     dl,cr               ;put cr in dl
  144.       int     21h               ;call DOS
  145.       mov     ah,5
  146.       mov     dl,lf               ;put lf in dl
  147.       int     21h               ;call DOS
  148.       ret
  149. crlf      endp
  150.  
  151. setp      ends
  152. end      begin
  153.